< previous page page_84 next page >

Page 84
   Dim bExclusive As Boolean ' declare true/false var
   Dim bReadOnly As Boolean ' declare true/false var

   cDBName = "c:\tysdbvb5\source\data\books5.mdb" ' point to database
   cTblName = "Authors" ' point to authors table
   bExclusive = True ' set to exclusive open
   bReadOnly = True ' set to read only
   '
   Data1.DatabaseName = cDBName ' set database property
   Data1.RecordSource = cTblName ' set recordsource property
   Data1.Exclusive = bExclusive
   Data1.ReadOnly = bReadOnly
   '
   Data1.Refresh ' update data control properties
End Sub
Now, save your work before entering more Visual Basic code.
Setting the Options Property
All the properties you have set in the previous code relate to the database that Visual Basic is accessing. The Options property of the Visual Basic data control allows you to establish the properties of the Dynaset opened in the RecordSource property of the data control. There are several options that can be set in the Options property of the data control. In today's lesson, you will learn about the three most commonly used options.
Here are the three Options values for the data control that is covered today:
· dbDenyWrite
· dbReadOnly
· dbAppendOnly
These three options are actually Visual Basic constants that are predefined in the language. They are like Visual Basic variables, except that they have a single, set value that cannot be changed. Table 4.1 shows the three constants and their numeric values.
Table 4.1. Dynaset option values.
Dynaset OptionNumeric Value
dbDenyWrite1
dbReadOnly4
dbAppendOnly8

 
< previous page page_84 next page >

If you like this book, buy it!